import { formRules } from "@/utils/checkForm";

const app = getApp();

const rules = {
  name: [
    {
      required: true,
      message: "请输入姓名",
    },
  ],
  mobile: [
    {
      required: true,
      message: "请输入手机",
    },
  ],
};
Page({
  data: {
    btnHeight: 67,
    contentSafeHeight: app.globalData.contentSafeHeight,
    name: "",
    gender: "1",
    selectList: ["篮球", "足球", "羽毛球"],
    selectItem: "篮球",
    showselector: false,
  },
  ces() {
    const { name, gender } = this.data;
    console.log(name, gender);
    // formRules(rules, { name, gender }, (status) => {
    //   if (status) {
    //     console.log("校验通过");
    //   }
    // });
  },
  //打开选择器弹出层
  onClick() {
    this.setData({
      showselector: true,
    });
  },
  //多选-取消
  onCancel() {
    this.setData({
      showselector: false,
    });
  },
  //多选-确认
  onConfirm(event) {
    const { picker, value, index } = event.detail;
    console.log(`当前值：${value}, 当前索引：${index}`);
    this.setData({
      showselector: false,
      selectItem: value,
    });
  },
});
